package com.jt.www.domain.enums.pc;

import org.assertj.core.util.Lists;

import java.util.List;

/**
 * 渠道编码
 *
 * @author lq
 * @create 2020-04-21 15:42
 */
public enum TeamMembersLevelEnum {
    LEVEL_0("业务经理", "0"),
    LEVEL_1("业务员", "1"),
    LEVEL_2("创始人", "2");

    private String msg;
    private String code;

    TeamMembersLevelEnum(String msg, String code) {
        this.msg = msg;
        this.code = code;
    }

    public static String getMsgByCode(String code) {
        for (TeamMembersLevelEnum teamMembersLevelEnum : TeamMembersLevelEnum.values()) {
            if (teamMembersLevelEnum.code.equals(code)) {
                return teamMembersLevelEnum.msg;
            }
        }
        return "";
    }

    /**
     * 得到非创始人的levelCode
     *
     * @return
     */
    public static String getNotFounder() {
        List<String> levelCode = Lists.newArrayList();
        for (TeamMembersLevelEnum teamMembersLevelEnum : TeamMembersLevelEnum.values()) {
            if (!teamMembersLevelEnum.equals(LEVEL_2)) {
                levelCode.add(teamMembersLevelEnum.getCode());
            }
        }
        return String.join(",", levelCode);
    }

    public static void main(String[] args) {
        System.out.println(TeamMembersLevelEnum.getNotFounder());
    }


    public String getMsg() {
        return msg;
    }

    public String getCode() {
        return code;
    }
}
